matrix x=J(nstrata,7,0)
scalar nk=rowsof(z)
scalar ki=1
while ki<=nk{
scalar kk=z[ki,1]

scalar ii=1
while ii<=7{
matrix x[kk,ii]=w[ki,ii]
scalar ii=ii+1
}
scalar ki=ki+1
}
